﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using PicHunter.Task;

namespace PicHunter.Task
{
    public class TaskManager
    {
        public void Add(Task task)
        {
            ThreadPool.QueueUserWorkItem(new WaitCallback(ThreadProc), task);
        }

        public void Add(Task[] tasks)
        {
            foreach (Task t in tasks)
                Add(t);
        }

        static void ThreadProc(Object taskObj)
        {
            Task task = taskObj as Task;
            task.DoWork();
        }
    }
}
